home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.07 Jul 90 / Tuning MPW ƒ / Instrumented main program / DrawDragon.m
Encoding:
Text File  |  1989-08-26  |  1.8 KB  |  77 lines  |  [TEXT/MPS ]

  1. (******************************************************)
  2. (*                                                      *)
  3. (*    Main program to test Dragon method.                  *)
  4. (*    This version includes MPW performance analyzer      *)
  5. (*    calls.                                              *)
  6. (*                                                      *)
  7. (*    Written in SemperSoft Modula-2 v.1.1.2              *)
  8. (*                                                      *)
  9. (*    Allen Stenger    August 1989                        *)
  10. (*                                                      *)
  11. (******************************************************)
  12.  
  13. MODULE DrawDragon;
  14.  
  15. FROM InOut            IMPORT WriteLong, WriteString, Read;
  16. FROM InsideMac        IMPORT TickCount;
  17. FROM Perform        IMPORT InitPerf, PerfControl, 
  18.                             PerfDump, TermPerf, 
  19.                             TP2PerfGlobals;
  20. FROM DragonModule    IMPORT Dragon;
  21. FROM Pen            IMPORT Home;
  22.  
  23.     
  24. VAR
  25.     oldTime,
  26.     newTime        :    LONGINT;
  27.     ch             :     CHAR;
  28.     thePerfGlobals : TP2PerfGlobals;
  29.     junk : BOOLEAN;
  30.  
  31. BEGIN
  32.     (* Initialize performance measurement *)
  33.     thePerfGlobals := NIL;
  34.     IF InitPerf(     
  35.                 thePerfGlobals, (* measurement block *)
  36.                 20,            (* sample interval *)
  37.                 8,            (* bucket size *)
  38.                 TRUE,        (* measure ROM *)
  39.                 TRUE,        (* measure application *)
  40.                 "CODE",        (* resource type to 
  41.                                     measure *)
  42.                 0,            (* ROM ID *)
  43.                 '',            (* ROM name *)
  44.                 FALSE,        (* measure RAM misses *)
  45.                 0,0,0        (* for RAM misses *)
  46.             )
  47.     THEN
  48.     ELSE WriteString( "Initialization failed" );
  49.     END; (* IF *)
  50.     
  51.     (* Start performance measurement *)
  52.     junk := PerfControl( thePerfGlobals, TRUE );
  53.     
  54.     oldTime := TickCount();
  55.  
  56.     Home;
  57.     Dragon( 8 );
  58.     
  59.     newTime := TickCount();
  60.     
  61.     (* End performance measurement *)
  62.     IF 0 = PerfDump(     thePerfGlobals,
  63.                 "DrawDragon.dump",    (* dump file for 
  64.                                         results *)
  65.                 FALSE,                (* histograms *)
  66.                 0                    (* histograms *)
  67.             )
  68.     THEN
  69.     ELSE WriteString( "PerfDump failed" );
  70.     END; (* IF *)
  71.     TermPerf( thePerfGlobals );
  72.     
  73.     WriteString( "Run time is " );
  74.     WriteLong( newTime - oldTime, 6 );
  75.     WriteString( " -- press space to exit " );
  76.     Read( ch );
  77. END DrawDragon.